// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   AbstractTabSclPane.java

package com.boci.common.ui;

import java.awt.Point;
import java.util.*;
import javax.swing.*;

// Referenced classes of package com.boci.common.ui:
//            AbstractPanel

public abstract class AbstractTabSclPane extends JScrollPane
{

    public AbstractPanel getPanel(String pScrName)
    {
        return (AbstractPanel)screenMap.get(pScrName);
    }

    public void addPanel(String pStrScreen, AbstractPanel pPanel)
    {
        screenMap.put(pStrScreen, pPanel);
        rootPanel.add(pPanel);
    }

    public void refreshScreen()
    {
        Set keySet = screenMap.keySet();
        Iterator iterator = keySet.iterator();
        do
        {
            if(!iterator.hasNext())
                break;
            AbstractPanel p = (AbstractPanel)screenMap.get(iterator.next());
            if(p.isVisible())
                p.refresh();
        } while(true);
    }

    public AbstractPanel getCurrentScreen()
    {
        AbstractPanel rtnPanel = null;
        Set keySet = screenMap.keySet();
        Iterator iterator = keySet.iterator();
        do
        {
            if(!iterator.hasNext())
                break;
            AbstractPanel p = (AbstractPanel)screenMap.get(iterator.next());
            if(!p.isVisible())
                continue;
            rtnPanel = p;
            break;
        } while(true);
        return rtnPanel;
    }

    public void showScreen(String pStrScreen)
    {
        showScreen(pStrScreen, true);
    }

    public void showScreen(String pStrScreen, boolean pRefreshPanel)
    {
        Set keySet = screenMap.keySet();
        AbstractPanel p;
        for(Iterator iterator = keySet.iterator(); iterator.hasNext(); p.setVisible(false))
            p = (AbstractPanel)screenMap.get(iterator.next());

        getViewport().setViewPosition(new Point(0, 0));
        p = (AbstractPanel)screenMap.get(pStrScreen);
        p.setVisible(true);
        if(pRefreshPanel)
            p.refresh();
        else
            p.setDefFocus();
    }

    public abstract void showDefaultScr();

    public AbstractTabSclPane(Locale pLocale)
    {
        screenMap = new HashMap();
        initGUI(pLocale);
    }

    private void initGUI(Locale pLocale)
    {
        rootPanel = new JPanel();
        rootPanel.setLayout(new BoxLayout(rootPanel, 1));
        setViewportView(rootPanel);
        getVerticalScrollBar().setUnitIncrement(10);
    }

    public void setText(Locale pLocale)
    {
        Set keySet = screenMap.keySet();
        AbstractPanel abstractPanel;
        for(Iterator iterator = keySet.iterator(); iterator.hasNext(); abstractPanel.setText(pLocale))
            abstractPanel = (AbstractPanel)screenMap.get(iterator.next());

    }

    public abstract String getModuleName();

    HashMap screenMap;
    JPanel rootPanel;
}
